<?php
include("class.phpmailer.php");
include("class.smtp.php"); 
//你只需填写以下信息即可****************************
$smtp = "smtp.qq.com";//必填，设置SMTP服务器 QQ邮箱是smtp.qq.com ，QQ邮箱默认未开启，请在邮箱里设置开通。网易的是 smtp.163.com 或 smtp.126.com
$youremail =  '825369851@qq.com'; // 必填，开通SMTP服务的邮箱；也就是发件人Email。(本系统功能也就是自己给自己发邮件)
$password = "shao#zhuo$1989"; //必填， 以上邮箱对应的密码
$ymail = "710633139@qq.com"; //收信人的邮箱地址，也就是你自己收邮件的邮箱
$yname = "北京智富者机器人科技有限公司"; //收件人称呼
//填写信息结束 ****************************
function get_ip(){
   if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
       $ip = getenv("HTTP_CLIENT_IP");
   else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
       $ip = getenv("HTTP_X_FORWARDED_FOR");
   else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
       $ip = getenv("REMOTE_ADDR");
   else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
       $ip = $_SERVER['REMOTE_ADDR'];
   else
       $ip = "unknown";
   return($ip);
}
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true; 
$mail->Host = $smtp; 
$mail->CharSet = "utf-8";
$mail->Username = $youremail; 
$mail->Password = $password; //必填， 以上邮箱对应的密码
$mail->From = $youremail; 
$mail->FromName = "反馈系统"; 
$mail->AddAddress($ymail,$yname);
if(isset($_POST['add'])){
if($_POST['add']=='1'){
	$yourname = $_POST['yourname'];
	$tel = $_POST['tel'];
	$qq = $_POST['qq'];
	$email = $_POST['email'];
  $company = $_POST['company'];
	$message = $_POST['message'];
	
	$ip = get_ip();
	
	$mail->Subject = $yourname."-【留言反馈】"; 
	date_default_timezone_set('Asia/BeiJing');
	$time = date("Y-m-d H:i:s",time());
	
	$html = '企业：'.$company.'<br>姓名：'.$yourname.'<br>电话：'.$tel.'<br>QQ：'.$qq.'<br>邮箱：'.$email.'<br>IP：'.$ip.'<br>提交时间：'.$time.'<br>内容：'.$message;
	
	$mail->MsgHTML($html);
	
	$mail->IsHTML(true); 
	if(!$mail->Send()) {
		//header("Content-Type: text/html; charset=utf-8");
		echo '<script>alert("提交失败了！");history.go(-1);</script>';
	} else {
		//header("Content-Type: text/html; charset=utf-8");
	    echo '<script>alert("提交成功！感谢你的反馈。");history.go(-1);</script>';
	}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>留言反馈 - By knifecms.com</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="bug.js"></script>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
     var Tab1 = new tabObject("#tabs", "#contents");
              Tab1.actTitleCss = "act";
              Tab1.initTab();
    });
</script>
</head>
<body>
<div id="content">
	<div class="title">客户反馈调查表</div>
  
	<div class="main">
    <div id="swap">
		<div id="tabs">
        <div class="act1"><a href="javascript:void(0);">出现故障</a></div>
        <div class="act2"><a href="javascript:void(0);">建议或二次开发需求</a></div>
    </div>
		
		<div id="contents">
		<div style="display:block;">
		<form action="" method="post" onsubmit="return ck();">
			<table width="100%" cellspacing="0" cellpadding="5" border="0">
				<tbody>
					<tr valign="top">
					<td width="22%" align="right" valign="middle" class="field">客服电话1:</td>
					<td valign="middle"><span class="tip">13911415506</span>
                    </td>
					</tr>					
					<tr valign="top">
					<td width="22%" align="right" valign="middle" class="field">客服电话2:</td>
					<td valign="middle"><span class="tip">15811593425</span>
                    </td>
					</tr>
				<tr valign="top">
					<td width="22%" align="right" valign="middle" class="field">在线客服:</td>
					<td valign="middle"><span class="tip"><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=825369851&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:825369851:43" alt="点我" title="点我"></a></span>
                    </td>
          </tr>
					<tr valign="top">
					<td width="22%" align="right" valign="middle" class="field">在线客服:</td>
					<td valign="middle"><span class="tip"><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=710633139&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:710633139:50" alt="点击这里给我发消息" title="点击这里给我发消息"></a></span>
                    </td>
          </tr>
        </tbody>
			</table>
		</form>
		</div>
		
		<div style="display:block;">
		<form action="" method="post" onsubmit="return ck();">
			<table width="100%" cellspacing="0" cellpadding="5" border="0">
				<tbody>
				<tr valign="top">
					<td width="22%" align="right" valign="middle" class="field">企业:</td>
					<td valign="middle">
						<input type="text" maxlength="40" size="26" id="company" name="company" /> <font color="red">*</font>
						<span class="tip">企业名称</span>
                    </td>
                </tr>
				<tr valign="top">
					<td width="22%" align="right" valign="middle" class="field">姓名:</td>
					<td valign="middle">
						<input type="text" maxlength="40" size="26" id="yourname" name="yourname" /> <font color="red">*</font>
						<span class="tip">姓名或昵称</span>
                    </td>
                </tr>
                <tr valign="top">
                    <td valign="middle" align="right" class="field">邮箱:</td>
                    <td>
						<input type="text" maxlength="40" size="26" id="email" name="email" />  
						<span class="tip">您的Email地址（建议填写）</span>
                    </td>
                </tr>
                
				<tr valign="top">
					<td valign="middle" align="right" class="field">QQ号码:</td>
					<td>
						<input type="text" maxlength="40" size="26" id="qq" name="qq" /> 
						<span class="tip">您的QQ号码</span>
					</td>
				</tr>
                
				<tr valign="top">
					<td valign="middle" align="right" class="field">联系电话:</td>
					<td>
						<input type="text" maxlength="15" size="26" id="tel" name="tel" /> 
						<span class="tip">电话或手机号</span>
					</td>
				</tr>
                
				<tr valign="top">
					<td valign="middle" align="right" class="field">内容:</td>
					<td>
						<textarea name="message" id="message" cols="60" rows="7"></textarea> <font color="red">*</font>
                    </td>
                </tr>
                
                <tr valign="top">
					<td class="field"></td>
					<td><input name="add" type="hidden" value="1" />
						<input type="submit" value="提 交" /> <font color="red"><?php 
					if(isset($ok)){
						echo $ok; 
					}
					?></font>
					</td>
                </tr>
                </tbody>
			</table>
		</form>
		</div>
    </div>
</div>		
	</div>
</div>
<div id="footer">
By <a href="http://www.knifecms.com" target="_blank">北京智富者机器人科技有限公司</a></div>
</body>
</html>
